<?php
declare (strict_types=1);

namespace app\common\model;

class Cooperative extends Base
{
    protected $name = 'cooperative';

    public function p()
    {
        return $this->hasOne(Area::class, 'code', 'province')->field('code,province as title');
    }

    public function c()
    {
        return $this->hasOne(Area::class, 'code', 'city')->field('code,city as title');
    }

    public function d()
    {
        return $this->hasOne(Area::class, 'code', 'district')->field('code,district as title');
    }

    public function t()
    {
        return $this->hasOne(Area::class, 'code', 'town')->field('code,town as title');
    }


}
